home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bitstrg.zip / LTESTBIT.C < prev    next >
C/C++ Source or Header  |  1989-05-24  |  551b  |  31 lines

  1. /*
  2.     librairie : bitstrg
  3.  
  4.     ltestbit --    test l'etat d'un bit
  5.  
  6.  
  7.                 Le parametre nombre de bits est de type unsigned long
  8.  
  9.     Attention : en Small Memory Model le champ Data est limite a 64Koctets
  10. */
  11.  
  12. #include "bitstrg.h"
  13.  
  14. /*
  15.     Test specified bit
  16.  
  17.     return non zero if set, else return zero
  18. */
  19.  
  20. unsigned ltestbit(ptr,bit)
  21.     struct LSPARRAY * ptr;        /* pointer on structure */
  22.     unsigned long    bit;        /* bit number */
  23. {
  24.  
  25.     if(ptr->numlbit < bit) {
  26.         return(0);
  27.     }
  28.     
  29.     return((ptr->pntarray)[bit / SIZE] & (1 << (bit & (SIZE - 1))));    
  30. }
  31.